package com.gsbelarus.gedemin.income.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.gsbelarus.gedemin.income.fragment.BalanceFrgm;
import com.gsbelarus.gedemin.income.fragment.ClientsMonthListFrgm;
import com.gsbelarus.gedemin.income.fragment.IncomeFrgm;
import com.gsbelarus.gedemin.income.fragment.BalanceFrgmVP;
import com.gsbelarus.gedemin.income.fragment.ViewPagerDateFrgm;
import com.gsbelarus.gedemin.lib.ui.ArgumentsHelper;

import java.util.Calendar;

public class BalanceFrgmAdapter extends FragmentStatePagerAdapter {

    public BalanceFrgmAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        ViewPagerDateFrgm frgmVP = new ViewPagerDateFrgm();
        switch (position) {
            case BalanceFrgmVP.CLIENTS_FRGM:
                frgmVP.setArguments(ArgumentsHelper.putViewPagerInfo(null, ClientsMonthListFrgm.class.getName(), Calendar.MONTH));
                break;
            case BalanceFrgmVP.BALANCE_FRGM:
                return new BalanceFrgm();
            case BalanceFrgmVP.INCOME_FRGM:
                frgmVP.setArguments(ArgumentsHelper.putViewPagerInfo(null, IncomeFrgm.class.getName(), Calendar.DATE));
                break;
            default:
                return null;
        }
        return frgmVP;
    }

    @Override
    public int getCount() {
        return 3;
    }
}
